<!DOCTYPE html>
<html lang="en">
<head>
		<title>Snippets &mdash; Articles in Category misc</title>
		<meta charset="utf-8" />
		<link rel="profile" href="http://gmpg.org/xfn/11" />
		<link rel="stylesheet" type="text/css" href="https://corteousquestions.club/theme/css/style.css" />
		<link rel='stylesheet' id='oswald-css'  href='http://fonts.googleapis.com/css?family=Oswald&#038;ver=3.3.2' type='text/css' media='all' />
		<style type="text/css">
			body.custom-background { background-color: #f5f5f5; }
		</style>
		<link rel="alternate" type="application/atom+xml"
			title="Snippets — Flux Atom"
			href="https://corteousquestions.club/" /> 
		<!--[if lte IE 8]><script src="https://corteousquestions.club/theme/js/html5shiv.js"></script><![endif]-->
</head>

<body class="home blog custom-background " >
	<div id="container">
		<div id="header">
				<h1 id="site-title"><a href="https://corteousquestions.club">Snippets</a></h1>
<h2 id="site-description">All that I will forget is here</h2>		</div><!-- /#banner -->
		
		<div id="menu">
			<div class="menu-navigation-container">
				<ul id="menu-navigation" class="menu">
						<li class="active" class="menu-item menu-item-type-post_type menu-item-object-page"><a href="https://corteousquestions.club/category/misc.html">misc</a></li>

				</ul>
			</div> <!--/#menu-navigation-container-->
		</div><!-- /#menu -->
		
		<div class="page-title">
<div class="page-title">
	<h2>Filed under <span>misc</span> &hellip;</h2>
</div>
		</div>
	
		<div id="contents">
<div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/read-python-file-to-list.html">Mon 19 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/read-python-file-to-list.html" title="Permalink to How to read a file into a list" rel="bookmark">How to read a file into a list</a>
		</h2>
		<div class="entry-content">
			<hr>
<p>with open('C:/path/numbers.txt') as f:
     lines = f.read().splitlines()</p>
<hr>
<p>this will give you a list of values (strings)
 you had in your file, with newlines stripped.
 https://bit.ly/38TxQ4y</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/file.html" rel="tag">file</a>,  <a href="https://corteousquestions.club/tag/list.html" rel="tag">list</a>,  <a href="https://corteousquestions.club/tag/python.html" rel="tag">python</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/linebreak-create.html">Mon 19 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/linebreak-create.html" title="Permalink to Create a linebreak in Markdown" rel="bookmark">Create a linebreak in Markdown</a>
		</h2>
		<div class="entry-content">
			<p>To create a line break in Markdown, add two spaces in the end of the line.</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/blog.html" rel="tag">blog</a>,  <a href="https://corteousquestions.club/tag/line-break.html" rel="tag">line break</a>,  <a href="https://corteousquestions.club/tag/markdown.html" rel="tag">markdown</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/editor.html">Mon 19 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/editor.html" title="Permalink to Edit command line commands in Editor" rel="bookmark">Edit command line commands in Editor</a>
		</h2>
		<div class="entry-content">
			<p>Suppose you are typing a very long command line:
 PATH='/home/alw/bin:/home/alw/bin:/home/alw/bin:
 /usr/local/sbin:/usr/local/bin:/usr/sbin:
 /usr/bin:/sbin:/bin:/usr/games:/usr/local/games:
 /snap/bin'
 You discover a mistake before you hit Enter. Or
 you discover it later and call the line back in
 your history. You can edit on the command line,
 of course, but if you prefer your editor of
 choice press Control+X Control+E. Your default
 editor (usually set with $EDITOR or $VISUAL)
 will start with the command loaded.
 https://bit.ly/2Y96wc4</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/command-line.html" rel="tag">command line</a>,  <a href="https://corteousquestions.club/tag/editing.html" rel="tag">editing</a>,  <a href="https://corteousquestions.club/tag/editor.html" rel="tag">editor</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/trepan3k.html">Mon 19 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/trepan3k.html" title="Permalink to Using Python Debugger Trepan3k" rel="bookmark">Using Python Debugger Trepan3k</a>
		</h2>
		<div class="entry-content">
			<p>To use the Trepan3k (python 3 version of Trepan2), we can,as an
 example, construct the following command line expression:</p>
<hr>
<p>trepan3k --highlight=light -o <somefile.txt> file_to_debugged.py</p>
<hr>
<p>The flag '--highlight', colorizes the output. It can be light or
 dark.
 The flag '-o' defines to what file will go the output of the
 debugging. BEWARE, if you choose this, you wont see the output
 when running it from the terminal.
 https://python2-trepan.readthedocs.io</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/debug.html" rel="tag">debug</a>,  <a href="https://corteousquestions.club/tag/debugger.html" rel="tag">debugger</a>,  <a href="https://corteousquestions.club/tag/trepan3k.html" rel="tag">trepan3k</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/bindkeys-zsh.html">Mon 19 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/bindkeys-zsh.html" title="Permalink to Create bindkeys in ZSH" rel="bookmark">Create bindkeys in ZSH</a>
		</h2>
		<div class="entry-content">
			<p>To bind a key to a preset command or a command of your own, we first
  need to know what is the code of the key that you intend on using.
  Let's say I want to use the F2 key;</p>
<hr>
<p>1 - 'showkey -a'</p>
<hr>
<div class="highlight"><pre><span></span><code><span class="err">After opening the session, just click on the key you want:</span>
</code></pre></div>


<hr>
<p>2 - 'F2'
  3 - ^[OQ  27 0033 0x1b
            79 0117 0x4f
            81 0121 0x51</p>
<hr>
<p>The code to use is '^[OQ'. Then it can be as simple as:</p>
<hr>
<p>bindkey ^[OQ 'ls -la'</p>
<hr>
<p>or more complex as the case of the one that opens a file in the right
  side of current window, as a scratchpad:</p>
<hr>
<p>bindkey -s '^[OQ tilix -a session-add-right -x '
  micro /home/mic/scratchpad'<simbolo de acento circumflexo>M</p>
<hr>
<p>https://bit.ly/3c9doyn</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/bind.html" rel="tag">bind</a>,  <a href="https://corteousquestions.club/tag/keys.html" rel="tag">keys</a>,  <a href="https://corteousquestions.club/tag/zsh.html" rel="tag">zsh</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/script-journalctl.html">Mon 19 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/script-journalctl.html" title="Permalink to Send script output to journalctl" rel="bookmark">Send script output to journalctl</a>
		</h2>
		<div class="entry-content">
			<p>To send the script output to journalctl,
 you do the following:</p>
<hr>
<p>sudo systemd-cat ./path/to/script</p>
<hr>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/journalctl.html" rel="tag">journalctl</a>,  <a href="https://corteousquestions.club/tag/logging.html" rel="tag">logging</a>,  <a href="https://corteousquestions.club/tag/logs.html" rel="tag">logs</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/external-ssl.html">Mon 19 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/external-ssl.html" title="Permalink to Using openssl to connect externally" rel="bookmark">Using openssl to connect externally</a>
		</h2>
		<div class="entry-content">
			<p>This subject came to me, when I needed to connect with a mail<br>
  server that had ssl encryptation. To link to it you do the<br>
  following:  </p>
<hr>
<p>openssl s_client --connect <server name:port>  </p>
<hr>
<p>After that it will probably be needed login information, which<br>
  can be inputted in the following manner:  </p>
<hr>
<p>a1 login <username> <password>  </p>
<hr>
<p>Notice the 'a1' tag. It can be anything you like, but it must<br>
  be consistent. For instances, after 'a1' must come 'a2', and
  so on.  </p>
<hr>
<p>a2 list '' '*'  </p>
<hr>
<p>Shows a list of your mailboxes.  </p>
<hr>
<p>a3 examine <mailbox name>  </p>
<hr>
<p>Gives you metadata about the mailbox.  </p>
<hr>
<p>a4 select <mailbox name>  </p>
<hr>
<p>Selects a particular mailbox  </p>
<hr>
<p>a5 fetch 1 body[]  </p>
<hr>
<p>Fetches the first email in the mailbox.  </p>
<hr>
<p>For more information see:<br>
  https://bit.ly/38HrK76<br>
  https://tools.ietf.org/html/rfc3501#page-27  </p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/mail.html" rel="tag">mail</a>,  <a href="https://corteousquestions.club/tag/openssl.html" rel="tag">openssl</a>,  <a href="https://corteousquestions.club/tag/ssl.html" rel="tag">ssl</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/send-scripts-output-to-journalctl.html">Sun 18 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/send-scripts-output-to-journalctl.html" title="Permalink to Send scripts output to journalctl" rel="bookmark">Send scripts output to journalctl</a>
		</h2>
		<div class="entry-content">
			<p>To send the script output to journalctl,<br>
 you do the following:  </p>
<hr>
<p>sudo systemd-cat ./path/to/script  </p>
<hr>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/journalctl.html" rel="tag">journalctl</a>,  <a href="https://corteousquestions.club/tag/logging.html" rel="tag">logging</a>,  <a href="https://corteousquestions.club/tag/logs.html" rel="tag">logs</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/list-triggers-in-sqlite-db.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/list-triggers-in-sqlite-db.html" title="Permalink to "List triggers in SQLite db"" rel="bookmark">"List triggers in SQLite db"</a>
		</h2>
		<div class="entry-content">
			<p>select * from sqlite_master where type = 'trigger';</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/search.html" rel="tag">"search"]</a>,  <a href="https://corteousquestions.club/tag/sqlite.html" rel="tag">"sqlite"</a>,  <a href="https://corteousquestions.club/tag/triggers.html" rel="tag">["triggers"</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/setting-up-nginx-server.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/setting-up-nginx-server.html" title="Permalink to Setting up nginx server" rel="bookmark">Setting up nginx server</a>
		</h2>
		<div class="entry-content">
			<p>I'm trying out the Nginx web server instead of Apache because<br>
   I've been hearing a lot about how much easier it is to<br>
   configure, and that it's faster etc, etc. I can now say with<br>
   authority, that is not easier to configure, it's harder, but<br>
   it's a good harder, because makes you have more control about<br>
   what you're setting up. So, I'll leave here the server block<br>
   (Nginx version of Virtual Hosts), I made in 28/01/21, for a<br>
   a blog called 'Dazed and Confused':  </p>
<hr>
<p># server {<br>
          # Notice that, unlike Apache, you can't have the same<br>
          # port for IPV4 and IPV6. So you'll have to comment it<br>
          # out. <br>
          listen 443 ssl;<br>
          # listen [::]: 443 ssl;  </p>
<div class="highlight"><pre><span></span><code>      <span class="nt">root</span> <span class="o">/</span><span class="nt">var</span><span class="o">/</span><span class="nt">www</span><span class="o">/</span><span class="nt">constantconstipation</span><span class="p">.</span><span class="nc">club</span><span class="o">/</span><span class="nt">html</span><span class="o">/</span><span class="nt">public</span><span class="o">/;</span>  
      <span class="err">#</span> <span class="nt">Nginx</span> <span class="nt">serves</span> <span class="nt">what</span> <span class="nt">is</span> <span class="nt">described</span> <span class="nt">in</span> <span class="nt">the</span> <span class="nt">index</span> <span class="nt">files</span> <span class="nt">it</span>  
      <span class="err">#</span> <span class="nt">finds</span> <span class="nt">on</span> <span class="nt">the</span> <span class="nt">pages</span><span class="o">.</span>  
      <span class="nt">index</span> <span class="nt">index</span><span class="p">.</span><span class="nc">html</span> <span class="nt">index</span><span class="p">.</span><span class="nc">htm</span> <span class="nt">index</span><span class="p">.</span><span class="nc">nginx-debian</span><span class="p">.</span><span class="nc">html</span><span class="o">;</span>

      <span class="nt">server_name</span> <span class="nt">constantconstipation</span><span class="p">.</span><span class="nc">club</span> <span class="nt">www</span><span class="p">.</span><span class="nc">constantconstipation</span><span class="p">.</span><span class="nc">club</span><span class="o">;</span>

      <span class="nt">location</span> <span class="o">/</span> <span class="p">{</span>  
              <span class="err">try_files</span> <span class="err">$uri</span> <span class="err">$uri/</span> <span class="err">=404</span><span class="p">;</span>  
      <span class="p">}</span>  
      <span class="err">#</span> <span class="nt">Nginx</span> <span class="nt">wasn</span><span class="s1">&#39;t finding the blog folder content, nor it&#39;</span><span class="nt">s</span>  
      <span class="err">#</span> <span class="nt">css</span> <span class="nt">structure</span><span class="o">.</span> <span class="nt">So</span> <span class="nt">I</span> <span class="nt">inserted</span> <span class="nt">the</span> <span class="s1">&#39;try_files&#39;</span><span class="o">,</span> <span class="nt">and</span> <span class="nt">it</span>  
      <span class="err">#</span> <span class="nt">worked</span><span class="o">.</span> <span class="nt">The</span> <span class="nt">line</span><span class="s1">&#39;s meaning is this:  </span>
<span class="s1">      # &#39;</span><span class="nt">Checks</span> <span class="nt">the</span> <span class="nt">existence</span> <span class="nt">of</span> <span class="nt">files</span> <span class="nt">in</span> <span class="nt">the</span> <span class="nt">specified</span> <span class="nt">order</span>  
      <span class="err">#</span> <span class="nt">and</span> <span class="nt">uses</span> <span class="nt">the</span> <span class="nt">first</span> <span class="nt">found</span> <span class="nt">file</span> <span class="nt">for</span> <span class="nt">request</span> <span class="nt">processing</span><span class="o">;</span>  
      <span class="err">#</span> <span class="nt">the</span> <span class="nt">processing</span> <span class="nt">is</span> <span class="nt">performed</span> <span class="nt">in</span> <span class="nt">the</span> <span class="nt">current</span> <span class="nt">context</span><span class="o">.</span>  
      <span class="err">#</span> <span class="cp">[</span><span class="nx">...</span><span class="cp">]</span>  
      <span class="err">#</span> <span class="nt">If</span> <span class="nt">none</span> <span class="nt">of</span> <span class="nt">the</span> <span class="nt">files</span> <span class="nt">were</span> <span class="nt">found</span><span class="o">,</span> <span class="nt">an</span> <span class="nt">internal</span> <span class="nt">redirect</span>  
      <span class="err">#</span> <span class="nt">to</span> <span class="nt">the</span> <span class="nt">uri</span> <span class="nt">specified</span> <span class="nt">in</span> <span class="nt">the</span> <span class="nt">last</span> <span class="nt">parameter</span> <span class="nt">is</span> <span class="nt">made</span><span class="o">.</span><span class="s1">&#39;  </span>
<span class="s1">      location /blogs/ {  </span>
<span class="s1">              try_files $uri $uri/ =404;  </span>
<span class="s1">      }</span>

<span class="s1">      # This is what is requested for ssl connection. Mind you,  </span>
<span class="s1">      # this configuration is being used because, I already had  </span>
<span class="s1">      # the certbot certificate and needed to change it from an  </span>
<span class="s1">      # Apache server to Nginx. Probably if you download a  </span>
<span class="s1">      # certbot version for Nginx, it will do all this  </span>
<span class="s1">      # configuration for you. But if it doesn&#39;</span><span class="nt">t</span><span class="o">,</span> <span class="nt">you</span> <span class="nt">can</span>  
      <span class="err">#</span> <span class="nt">copy</span><span class="o">/</span><span class="nt">paste</span> <span class="nt">from</span> <span class="nt">the</span> <span class="nt">third</span> <span class="nt">row</span> <span class="nt">onward</span> <span class="nt">and</span> <span class="nt">it</span> <span class="nt">will</span> <span class="nt">run</span><span class="o">.</span>  
      <span class="err">#</span> <span class="nt">NOTE</span><span class="o">:</span> <span class="nt">in</span> <span class="nt">the</span> <span class="nt">last</span> <span class="nt">field</span><span class="o">,</span> <span class="s1">&#39;XSS-Protection&#39;</span><span class="o">,</span> <span class="nt">I</span> <span class="nt">had</span> <span class="nt">to</span> <span class="nt">change</span>  
      <span class="err">#</span> <span class="nt">the</span> <span class="nt">double</span> <span class="nt">quotes</span> <span class="nt">that</span> <span class="nt">were</span> <span class="nt">to</span> <span class="nt">apostrophes</span><span class="o">,</span> <span class="nt">or</span> <span class="nt">mysql</span> <span class="nt">would</span>  
      <span class="err">#</span> <span class="nt">respond</span> <span class="nt">with</span> <span class="nt">an</span> <span class="nt">error</span><span class="o">.</span> <span class="nt">If</span> <span class="nt">you</span> <span class="nt">have</span> <span class="nt">any</span> <span class="nt">problems</span><span class="o">,</span> <span class="nt">just</span> <span class="nt">put</span>  
      <span class="err">#</span> <span class="nt">double</span> <span class="nt">quotes</span> <span class="nt">in</span> <span class="nt">it</span><span class="o">.</span>  
      <span class="nt">ssl_certificate</span>     <span class="o">/</span><span class="nt">etc</span><span class="o">/</span><span class="nt">letsencrypt</span><span class="o">/</span><span class="nt">live</span><span class="o">/</span><span class="nt">constantconstipation</span><span class="p">.</span><span class="nc">club</span><span class="o">/</span><span class="nt">fullchain</span><span class="p">.</span><span class="nc">pem</span><span class="o">;</span>  
      <span class="nt">ssl_certificate_key</span> <span class="o">/</span><span class="nt">etc</span><span class="o">/</span><span class="nt">letsencrypt</span><span class="o">/</span><span class="nt">live</span><span class="o">/</span><span class="nt">constantconstipation</span><span class="p">.</span><span class="nc">club</span><span class="o">/</span><span class="nt">privkey</span><span class="p">.</span><span class="nc">pem</span><span class="o">;</span>  
      <span class="nt">ssl_protocols</span> <span class="nt">TLSv1</span><span class="p">.</span><span class="nc">2</span><span class="o">;</span>  
      <span class="nt">ssl_prefer_server_ciphers</span> <span class="nt">on</span><span class="o">;</span>  
      <span class="nt">ssl_ciphers</span> <span class="nt">ECDHE-RSA-AES256-GCM-SHA512</span><span class="p">:</span><span class="nd">DHE-RSA-AES256-GCM-SHA512</span><span class="p">:</span><span class="nd">ECDHE-RSA-AES256-GCM-SHA384</span><span class="p">:</span><span class="nd">DHE-RSA-AES256-GCM-SHA384</span><span class="p">:</span><span class="nd">ECDHE-RSA-AES256-SHA384</span><span class="o">;</span>  
      <span class="nt">ssl_ecdh_curve</span> <span class="nt">secp384r1</span><span class="o">;</span> <span class="err">#</span> <span class="nt">Requires</span> <span class="nt">nginx</span> <span class="o">&gt;=</span> <span class="nt">1</span><span class="p">.</span><span class="nc">1</span><span class="p">.</span><span class="nc">0</span>  
      <span class="nt">ssl_session_timeout</span>  <span class="nt">10m</span><span class="o">;</span>  
      <span class="nt">ssl_session_cache</span> <span class="nt">shared</span><span class="p">:</span><span class="nd">SSL</span><span class="p">:</span><span class="nd">10m</span><span class="o">;</span>  
      <span class="nt">ssl_session_tickets</span> <span class="nt">off</span><span class="o">;</span> <span class="err">#</span> <span class="nt">Requires</span> <span class="nt">nginx</span> <span class="o">&gt;=</span> <span class="nt">1</span><span class="p">.</span><span class="nc">5</span><span class="p">.</span><span class="nc">9</span>  
      <span class="nt">ssl_stapling</span> <span class="nt">on</span><span class="o">;</span> <span class="err">#</span> <span class="nt">Requires</span> <span class="nt">nginx</span> <span class="o">&gt;=</span> <span class="nt">1</span><span class="p">.</span><span class="nc">3</span><span class="p">.</span><span class="nc">7</span>  
      <span class="nt">ssl_stapling_verify</span> <span class="nt">on</span><span class="o">;</span> <span class="err">#</span> <span class="nt">Requires</span> <span class="nt">nginx</span> <span class="o">=&gt;</span> <span class="nt">1</span><span class="p">.</span><span class="nc">3</span><span class="p">.</span><span class="nc">7</span>  
      <span class="nt">resolver</span> <span class="nt">8</span><span class="p">.</span><span class="nc">8</span><span class="p">.</span><span class="nc">8</span><span class="p">.</span><span class="nc">8</span> <span class="nt">8</span><span class="p">.</span><span class="nc">8</span><span class="p">.</span><span class="nc">4</span><span class="p">.</span><span class="nc">4</span> <span class="nt">valid</span><span class="o">=</span><span class="nt">300s</span><span class="o">;</span>  
      <span class="nt">resolver_timeout</span> <span class="nt">5s</span><span class="o">;</span>  
      <span class="nt">add_header</span> <span class="nt">X-Frame-Options</span> <span class="nt">DENY</span><span class="o">;</span>  
      <span class="nt">add_header</span> <span class="nt">X-Content-Type-Options</span> <span class="nt">nosniff</span><span class="o">;</span>  
      <span class="nt">add_header</span> <span class="nt">X-XSS-Protection</span> <span class="s1">&#39;1; mode=block&#39;</span><span class="o">;</span>
</code></pre></div>


<p>}  </p>
<hr>
<p>The whole process: https://do.co/3t7zmIr  </p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/apache.html" rel="tag">apache</a>,  <a href="https://corteousquestions.club/tag/nginx.html" rel="tag">nginx</a>,  <a href="https://corteousquestions.club/tag/web-server.html" rel="tag">web-server</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/backblaze-reminder.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/backblaze-reminder.html" title="Permalink to Reminder for when recovering folders from backup" rel="bookmark">Reminder for when recovering folders from backup</a>
		</h2>
		<div class="entry-content">
			<p>When recovering files on folder backup disk, (sdd), remember to create .cache file in /home, .cache file in /root, cache file in var</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/backblaze.html" rel="tag">backblaze</a>,  <a href="https://corteousquestions.club/tag/backup.html" rel="tag">backup</a>,  <a href="https://corteousquestions.club/tag/folder.html" rel="tag">folder</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/boolean-mask.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/boolean-mask.html" title="Permalink to Boolean Mask Arrays" rel="bookmark">Boolean Mask Arrays</a>
		</h2>
		<div class="entry-content">
			<p>Boolean mask is very useful and handy, when it comes to count, modify,
 extract or manipulate values in an array based on certain condition
 or criteria:</p>
<hr>
<p>arr([1,2,3,4,5,6,7,8,9])</p>
<hr>
<p>Now we create a boolean condition:</p>
<hr>
<p>bool_array = arr &gt; 3
 print(bool_array)
 output: array([False,False,False,True,True,True,True,True,True])</p>
<hr>
<p>Now we create a boolean mask to filter all even numbers in 'arr':</p>
<hr>
<p>mask = 0 == arr % 2
 print(mask)
 output: array([False,True,False,True,False,True,False,True,False])</p>
<hr>
<p>Now with our mask, 'mask', we index on 'arr', that will return a
 1D array with the values that satisfy the condition:</p>
<hr>
<p>even_values = arr[mask]
 print(even_values)
 output: [2,4,6,8]</p>
<hr>
<p>https://bit.ly/2MPWcUb</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/boolean.html" rel="tag">boolean</a>,  <a href="https://corteousquestions.club/tag/mask.html" rel="tag">mask</a>,  <a href="https://corteousquestions.club/tag/numpy.html" rel="tag">numpy</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/cron-notifications.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/cron-notifications.html" title="Permalink to Send notifications through cron" rel="bookmark">Send notifications through cron</a>
		</h2>
		<div class="entry-content">
			<p>To send notifications through cron (as done in the todo app),<br>
 the command in the cron jobs need the following structure:  </p>
<hr>
<p>export DISPLAY=:0.0 &amp;&amp; XDG_RUNTIME_DIR=/run/user/$(id -u)<br>
 /usr/bin/notify-send '<text for notifications>'  </p>
<hr>
<p>Remember it must be sent as root. 'sudo crontab -e'  </p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/cron.html" rel="tag">cron</a>,  <a href="https://corteousquestions.club/tag/notifications.html" rel="tag">notifications</a>,  <a href="https://corteousquestions.club/tag/notifiy-send.html" rel="tag">notifiy-send</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/date.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/date.html" title="Permalink to Append date to a filename" rel="bookmark">Append date to a filename</a>
		</h2>
		<div class="entry-content">
			<p>Append date to a file name:<br>
echo 'export now=$(date +"%m_%d_%Y")' &gt;&gt; /home/mic/.zshenv<br>
source /home/mic/.zshenv<br>
touch ~/log-$now.log  </p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/append.html" rel="tag">append</a>,  <a href="https://corteousquestions.club/tag/date.html" rel="tag">date</a>,  <a href="https://corteousquestions.club/tag/file.html" rel="tag">file</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/duplicity.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/duplicity.html" title="Permalink to How to use Duplicity with Backblaze" rel="bookmark">How to use Duplicity with Backblaze</a>
		</h2>
		<div class="entry-content">
			<p>sudo duplicity / b2://00081b448e6173c0000000003:K000cicptHJ94U7Lw9AwcklPfrYT7pM@computer-image</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/backblaze.html" rel="tag">backblaze</a>,  <a href="https://corteousquestions.club/tag/backup.html" rel="tag">backup</a>,  <a href="https://corteousquestions.club/tag/duplicity.html" rel="tag">duplicity</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/grep.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/grep.html" title="Permalink to Grep usage" rel="bookmark">Grep usage</a>
		</h2>
		<div class="entry-content">
			<p>To search for a text pattern in a given area, use grep:</p>
<hr>
<p>'grep -r <pattern> </path>'</p>
<hr>
<p>As you used the '-r' flag, it will look recursively.
 https://bit.ly/3c91pRq</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/folder.html" rel="tag">folder</a>,  <a href="https://corteousquestions.club/tag/grep.html" rel="tag">grep</a>,  <a href="https://corteousquestions.club/tag/search-text.html" rel="tag">search text</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/ignore-flake8.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/ignore-flake8.html" title="Permalink to Ignore error Flake8" rel="bookmark">Ignore error Flake8</a>
		</h2>
		<div class="entry-content">
			<p>Add to the IGNORE list in the file:
 /usr/lib/python3.9/site-packages/flake8/defaults.py</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/error.html" rel="tag">error</a>,  <a href="https://corteousquestions.club/tag/flake8.html" rel="tag">flake8</a>,  <a href="https://corteousquestions.club/tag/ignore.html" rel="tag">ignore</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/incremental-backups.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/incremental-backups.html" title="Permalink to Make incremental backups with tar" rel="bookmark">Make incremental backups with tar</a>
		</h2>
		<div class="entry-content">
			<p>Create incremental backups with tar, in tar.gz format:  </p>
<hr>
<p>tar  --listed-incremental=<folder_name>-snapshot.file<br>
 -czf <folder_name>-$now.tar.gz /boot  </p>
<hr>
<p>https://bit.ly/3qNYHVQ<br>
 /home/mic/sripts/incremental_backup.sh  </p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/backup.html" rel="tag">backup</a>,  <a href="https://corteousquestions.club/tag/incremental.html" rel="tag">incremental</a>,  <a href="https://corteousquestions.club/tag/tar.html" rel="tag">tar</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/journalctl-pid.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/journalctl-pid.html" title="Permalink to Journalctl by PID" rel="bookmark">Journalctl by PID</a>
		</h2>
		<div class="entry-content">
			<p>To search journalctl by pid, say 2355,
 do the following:</p>
<hr>
<h2>'sudo journalctl _PID=2355'</h2>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/journalctl.html" rel="tag">journalctl</a>,  <a href="https://corteousquestions.club/tag/pid.html" rel="tag">pid</a>,  <a href="https://corteousquestions.club/tag/search.html" rel="tag">search</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/mail-cli.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/mail-cli.html" title="Permalink to Send email through cli" rel="bookmark">Send email through cli</a>
		</h2>
		<div class="entry-content">
			<p>To send an email through the cli app 'mail',
 this is what you have to do:</p>
<hr>
<p>mail destination@email.com
 Subject: Hello World
 Email Body.
 .
 <ctl+d></p>
<hr>
<p>To end the mail it is needed to put a dot in
 a clean line, and then press Control-D, to
 exit.
 To send an attachment:</p>
<hr>
<p>mail -A /opt/backup.sql -s Backup File
 user@example.com &lt; /dev/null</p>
<hr>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/cli.html" rel="tag">cli</a>,  <a href="https://corteousquestions.club/tag/email.html" rel="tag">email</a>,  <a href="https://corteousquestions.club/tag/mail.html" rel="tag">mail</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/manage-git-repo.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/manage-git-repo.html" title="Permalink to Manage git repo" rel="bookmark">Manage git repo</a>
		</h2>
		<div class="entry-content">
			<p>1 - Create a new repository, if needed,<br>
   2 - Change the current working directory<br>
       to your local project.<br>
   3 - Initialize the local directory as a<br>
       Git repository:  </p>
<hr>
<p>git init -b main  </p>
<hr>
<p>4 - Adds the files in the local<br>
       repository and stages them for<br>
       commit. To unstage a file, use 'git<br>
       reset HEAD YOUR-FILE':  </p>
<hr>
<p>git add --all  </p>
<hr>
<p>5 - Commit the files that you've staged<br>
       in your local repository.  </p>
<hr>
<p>git commit -m "First commit"  </p>
<hr>
<p>6 - copy the remote repository URL.<br>
   7 - add the URL for the remote repository<br>
       where your local repository will be<br>
       pushed:  </p>
<hr>
<p>git remote add origin  <REMOTE_URL>  </p>
<hr>
<p>8 - Push the changes in your local<br>
       repository to remote repository:  </p>
<hr>
<p>git push origin main  </p>
<hr>
<p>https://bit.ly/3rBK9ce<br>
   To use in gitea, change origin to<br>
   origin_gitea and enter with pwd,<br>
   minegit.club.<br>
   If you're creating a new remote do the<br>
   following:  </p>
<hr>
<p>Create a README.md file. If using<br>
     notabug.<br>
   git remote add <origin_name> <URL>  </p>
<hr>
<p>For pushing the changes, if the remote is<br>
   new, you'll have to change the default<br>
   remote. You can change it back afterwards.  </p>
<hr>
<p>git push --set-upstream origin_name \<br>
   main  </p>
<hr>
<p>https://tinyurl.com/ydozlp34  </p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/gitlab.html" rel="tag">gitlab</a>,  <a href="https://corteousquestions.club/tag/minegit.html" rel="tag">minegit</a>,  <a href="https://corteousquestions.club/tag/notabug.html" rel="tag">notabug</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/multiple-users.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/multiple-users.html" title="Permalink to Give write permissions to multiple users on a folder" rel="bookmark">Give write permissions to multiple users on a folder</a>
		</h2>
		<div class="entry-content">
			<p>1 - Create new group:</p>
<hr>
<p>sudo groupadd <new_group></p>
<hr>
<p>2 - Add users to it:</p>
<hr>
<p>sudo usermod -a -G <new_group> <user1>
 sudo usermod -a -G <new_group> <user2></p>
<hr>
<p>3 - Set new permissions:</p>
<hr>
<p>sudo chgrp -R <new_group> /path/to/the/directory
 sudo chmod -R 770 /path/to/the/directory</p>
<hr>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/chmod.html" rel="tag">chmod</a>,  <a href="https://corteousquestions.club/tag/permissions.html" rel="tag">permissions</a>,  <a href="https://corteousquestions.club/tag/users.html" rel="tag">users</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/nano-copy-paste.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/nano-copy-paste.html" title="Permalink to Copy/Paste in Nano" rel="bookmark">Copy/Paste in Nano</a>
		</h2>
		<div class="entry-content">
			<p>To copy/paste in nano, use the following commands:<br>
 ALt-a to set mark<br>
 Ctl-k to cut<br>
 Ctl-u to uncut in the same place<br>
 Ctl-u to uncut to new location  </p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/copy.html" rel="tag">copy</a>,  <a href="https://corteousquestions.club/tag/nano.html" rel="tag">nano</a>,  <a href="https://corteousquestions.club/tag/paste.html" rel="tag">paste</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/numpy-empty-array.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/numpy-empty-array.html" title="Permalink to Create a empty array in numpy and append elements" rel="bookmark">Create a empty array in numpy and append elements</a>
		</h2>
		<div class="entry-content">
			<hr>
<p>arr = np.array([])
 arr = np.append(arr, np.array([1,2,3]))
 arr = np.append(arr, np.array([4,5,6]))
 # arr is now [1,2,3,4,5,6]</p>
<hr>
<p>https://bit.ly/3sSxlzs</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/append.html" rel="tag">append</a>,  <a href="https://corteousquestions.club/tag/array.html" rel="tag">array</a>,  <a href="https://corteousquestions.club/tag/numpy.html" rel="tag">numpy</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/numpy-fancy-indexing.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/numpy-fancy-indexing.html" title="Permalink to Numpy fancy indexing" rel="bookmark">Numpy fancy indexing</a>
		</h2>
		<div class="entry-content">
			<p>Fancy indexing allows us to select entire rows or columns out of
 order.
 Fancy indexing allows us to grab any row using its index, let’s
 grab row 1, 2 and 3.
 We need to pass in a list of required rows in square brackets:
 Let's suppose a 2D array named 'arr':</p>
<hr>
<p>arr[[1,2,3]]
 output: array([[1,1,1],
                [2,2,2],
                [3,3,3]])</p>
<hr>
<p>Now with columns:</p>
<hr>
<p>arr[:,[3,2]]
 output: array([[3,2],
                [7,6],
                [1,0],
                [0,1]])</p>
<hr>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/fancy-indexing.html" rel="tag">fancy indexing</a>,  <a href="https://corteousquestions.club/tag/indexing.html" rel="tag">indexing</a>,  <a href="https://corteousquestions.club/tag/numpy.html" rel="tag">numpy</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/python-packages-installed-from-source.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/python-packages-installed-from-source.html" title="Permalink to Install Python package from source" rel="bookmark">Install Python package from source</a>
		</h2>
		<div class="entry-content">
			<p>sudo python setup.py install</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/package.html" rel="tag">package</a>,  <a href="https://corteousquestions.club/tag/python.html" rel="tag">python</a>,  <a href="https://corteousquestions.club/tag/setuppy.html" rel="tag">setup.py</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/see-inside-drives-without-mounting.html">Sat 17 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/see-inside-drives-without-mounting.html" title="Permalink to See inside drives without mounting" rel="bookmark">See inside drives without mounting</a>
		</h2>
		<div class="entry-content">
			<p>debugfs -R 'ls -l' /dev/sda6</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/devices.html" rel="tag">devices</a>,  <a href="https://corteousquestions.club/tag/drives.html" rel="tag">drives</a>,  <a href="https://corteousquestions.club/tag/mount.html" rel="tag">mount</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/dump-mysql.html">Sat 10 April 2021</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/dump-mysql.html" title="Permalink to How to dump a mysql database" rel="bookmark">How to dump a mysql database</a>
		</h2>
		<div class="entry-content">
			<p>You already created a procedure to backup MySQL db's<br>
 and the procedure is this. Example with db notes:<br>
 Transfer the db's to the external disk, thusly:  </p>
<hr>
<p>mysqldump -u mic notes -p &gt; <path/to/wherever/you/want>  </p>
<hr>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/backup.html" rel="tag">backup</a>,  <a href="https://corteousquestions.club/tag/dump.html" rel="tag">dump</a>,  <a href="https://corteousquestions.club/tag/mysql.html" rel="tag">mysql</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/create-dictionary-multiple-values.html">Sun 21 April 2019</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/create-dictionary-multiple-values.html" title="Permalink to Create dictionary with multiple values" rel="bookmark">Create dictionary with multiple values</a>
		</h2>
		<div class="entry-content">
			<p>There are a couple of ways to add values to key, and to create a list
 if one isn't already there. I'll show one such method in little steps.</p>
<hr>
<p>key = somekey
 a.setdefault(key, [])
 a[key].append(1)</p>
<hr>
<p>Results:</p>
<hr>
<blockquote>
<blockquote>
<blockquote>
<p>a
 {'somekey': [1]}
 Next, try:
 key ='somekey'
 a.setdefault(key, [])
 a[key].append(2)</p>
</blockquote>
</blockquote>
</blockquote>
<hr>
<p>Results:</p>
<hr>
<blockquote>
<blockquote>
<blockquote>
<p 2_="2]" _1_="[1," _somekey_:="'somekey':">a</p>
</blockquote>
</blockquote>
</blockquote>
<hr>
<p>The magic of setdefault is that it initializes the value for that key
 if that key is not defined, otherwise it does nothing. Now, noting
 that setdefault returns the key you can combine these into a single line:</p>
<hr>
<p>a.setdefault('somekey',[]).append('bob')</p>
<hr>
<p>Results:</p>
<hr>
<blockquote>
<blockquote>
<blockquote>
<p 2_="2," _1_="[1," _bob_="'bob']" _somekey_:="'somekey':">a</p>
</blockquote>
</blockquote>
</blockquote>
<hr>
<p>https://bit.ly/3p3h2O4</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/dictionary.html" rel="tag">dictionary</a>,  <a href="https://corteousquestions.club/tag/key.html" rel="tag">key</a>,  <a href="https://corteousquestions.club/tag/python.html" rel="tag">python</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/create-virtual-table-sqlite.html">Sun 21 April 2019</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/create-virtual-table-sqlite.html" title="Permalink to Create SQLite virtual table" rel="bookmark">Create SQLite virtual table</a>
		</h2>
		<div class="entry-content">
			<p>Example:</p>
<hr>
<p>CREATE VIRTUAL TABLE BookSearch USING fts5(ID, Title, Desc);
 INSERT INTO BookSearch SELECT ID, Title, Desc FROM Book;</p>
<hr>
<p>Search like this:</p>
<hr>
<p>SELECT Title FROM BookSearch WHERE BookSearch MATCH 'cat';</p>
<hr>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/fts5.html" rel="tag">fts5</a>,  <a href="https://corteousquestions.club/tag/sqlite.html" rel="tag">sqlite</a>,  <a href="https://corteousquestions.club/tag/virtual.html" rel="tag">virtual</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/alter-sqlite-table.html">Sun 21 April 2019</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/alter-sqlite-table.html" title="Permalink to Alter SQLite tables" rel="bookmark">Alter SQLite tables</a>
		</h2>
		<div class="entry-content">
			<p>Para alterar uma table que não possa ser alterada por
 sqlite-utils,podemos usar este modelo. É também mais seguro,
 que o sqlite-utils também faz alguma merda.</p>
<hr>
<p>PRAGMA foreign_keys=off;
 BEGIN TRANSACTION;
 CREATE TABLE IF NOT EXISTS new_table(
    column_definition,
 );
 INSERT INTO new_table(column_list)
 SELECT column_list
 FROM table;
 DROP TABLE table;
 ALTER TABLE new_table RENAME TO table;
 COMMIT;
 PRAGMA foreign_keys=on;</p>
<hr>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/sqlite.html" rel="tag">sqlite</a>,  <a href="https://corteousquestions.club/tag/table.html" rel="tag">table</a>,  <a href="https://corteousquestions.club/tag/talbes.html" rel="tag">talbes</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/create-sqlite-tables.html">Sun 21 April 2019</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/create-sqlite-tables.html" title="Permalink to Create SQLite table" rel="bookmark">Create SQLite table</a>
		</h2>
		<div class="entry-content">
			<p>Example:</p>
<hr>
<p>CREATE TABLE notes (
 id INTEGER PRIMARY KEY,
 title TEXT,
 k1 TEXT,
 k2 TEXT,
 k3 TEXT,
 note TEXT,
 time DATETIME DEFAULT CURRENT_TIMESTAMP);</p>
<hr>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/sqlite.html" rel="tag">sqlite</a>,  <a href="https://corteousquestions.club/tag/table.html" rel="tag">table</a>,  <a href="https://corteousquestions.club/tag/tables.html" rel="tag">tables</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/triggers-for-sqlite3.html">Sun 21 April 2019</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/triggers-for-sqlite3.html" title="Permalink to Create triggers for Sqlite3 databases" rel="bookmark">Create triggers for Sqlite3 databases</a>
		</h2>
		<div class="entry-content">
			<p>Here's one example of the three trigger you must create:</p>
<hr>
<p>CREATE TRIGGER aft_insert AFTER INSERT ON pwd
 BEGIN
 INSERT INTO pwd_fts(pwdid, site, username, passwd, comment, time)
 VALUES(new.pwdid, new.site, new.username, new.passwd, new.comment, new.time);
 END;</p>
<hr>
<p>CREATE TRIGGER aft_del AFTER DELETE ON pwd
 BEGIN
INSERT INTO pwd_fts(pwdid, site, username, passwd, comment, time)
 VALUES ('delete', old.pwdid, old.site, old.username, old.passwd, old.comment, old.time);
 END;</p>
<hr>
<p>CREATE TRIGGER aft_updt AFTER UPDATE ON pwd
 BEGIN
 INSERT INTO pwd_fts(pwdid, site, username, passwd, comment, time)
 VALUES ('delete', old.pwdid, old.site, old.username, old.passwd, old.comment, old.time);
 INSERT INTO pwd_fts(pwdid, site, username, passwd, comment, time)
 VALUES(new.pwdid, new.site, new.username, new.passwd, new.comment, new.time);
 END;</p>
<hr>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/sqlite.html" rel="tag">sqlite</a>,  <a href="https://corteousquestions.club/tag/trigger-triggers.html" rel="tag">trigger. triggers</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/print-file-content.html">Sun 21 April 2019</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/print-file-content.html" title="Permalink to Print file content" rel="bookmark">Print file content</a>
		</h2>
		<div class="entry-content">
			<p>Opening a file in python for reading is easy:
 with open('example.txt', 'r') as f:
 To get everything in the file, just use read()
 file_contents = f.read()
 And to print the contents, just do:
 print (file_contents)
 https://bit.ly/3io5Ucd</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/file.html" rel="tag">file</a>,  <a href="https://corteousquestions.club/tag/print.html" rel="tag">print</a>,  <a href="https://corteousquestions.club/tag/python.html" rel="tag">python</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post--><div class="post type-post status-publish format-standard hentry category-general" id="post">
	<div class="entry-meta">
		<div class="date"><a href="https://corteousquestions.club/delete-lines-from-file-python.html">Sun 21 April 2019</a></div>
		<span class="byline">By <a href="https://corteousquestions.club/author/mclds.html">mclds</a></span>
			<span class="cat-links"><a href="https://corteousquestions.club/category/misc.html" title="View all posts in misc" rel="category tag">misc</a></span>
	</div> <!-- /#entry-meta -->
	<div class="main">
		<h2 class="entry-title">
			<a href="https://corteousquestions.club/delete-lines-from-file-python.html" title="Permalink to Delete lines from file" rel="bookmark">Delete lines from file</a>
		</h2>
		<div class="entry-content">
			<p>You need to open the file and read its contents in memory,
 then open the file again write the line to it but without
 the line you wish to omit
 Example:</p>
<hr>
<p>with open('yourfile.txt', 'r') as f:
     lines = f.readlines()
 with open('yourfile.txt', 'w') as f:
     for line in lines:
             if line.strip('
') != 'nickname_to_delete':
                 f.write(line)'</p>
<hr>
<p>https://bit.ly/3nUlzRp</p>
		</div> <!--/#entry-content-->
    		<span class="tag-links"><strong>Tagged</strong>
 <a href="https://corteousquestions.club/tag/delete.html" rel="tag">delete</a>,  <a href="https://corteousquestions.club/tag/file.html" rel="tag">file</a>,  <a href="https://corteousquestions.club/tag/python.html" rel="tag">python</a>    		</span>
	</div> <!--/#main-->
</div>  <!--/#post-->		</div>
		
		<div id="footer">
			<p>Powered by <a href="http://getpelican.com">Pelican</a>, theme by <a href="http://bunnyman.info">tBunnyMan</a>.</p>
		</div><!-- /#footer -->
	</div><!-- /#container -->
	<div style="display:none"></div>
</body>
</html>